<template>
  <!--理赔提交确认页面-->
  <div>
    <p class="tip">请确认信息无误，提交后将无法更改</p>
    <ul class="list">
      <li v-for="(insurant,index) in insurantList">
        <p class="title">延误人{{index + 1}}</p>
        <ul>
          <li>
            <p>被保险人姓名</p>
            <p>{{insurant.userName}}</p>
          </li>
          <li>
            <p>身份证号</p>
            <p>{{insurant.identityNo}}</p>
          </li>
          <li>
            <p>银行卡号</p>
            <p><span>{{insurant.bankNo}}</span></p>
          </li>
          <li>
            <p>开卡银行</p>
            <p>{{insurant.depositBank}}</p>
          </li>
          <li>
            <div style="margin-top: 10px">
              <img :src="insurant.boardingPassImg | imgPathFilter"  width="100%">
              <span>登机牌</span>
            </div>
            <div style=".margin-top: 10px">
              <img :src="insurant.proveImg | imgPathFilter"  width="100%">
              <span>延误证明</span>
            </div>
          </li>
        </ul>
      </li>
    </ul>
    <p class="offer" @click="goConfirm(insurantList)">确认提交</p>
  </div>
</template>

<script type="text/ecmascript-6">
  import {delayriskSub} from '../../../../test/unit/http'
  import {Toast} from 'we-vue'
  export default {
    name: 'lipeiconfirm',
    props: {},
    data() {
      return {
        insurantList: []
      };
    },
    methods: {
      goConfirm(insurantList){
        let insurantData = JSON.stringify(insurantList);
        let delayriskId = this.$route.query.delayriskId;
        let params = {insurantData: insurantData, delayriskId: delayriskId};
        this.goDelayriskSub(params);
      },
      goDelayriskSub(params){
        delayriskSub(params).then(res => {
          console.log(res);
          if (res.code == 100) {
            this.$router.push({path: 'tijiaosuccess', query: {delayriskId: params.delayriskId}})
          }
        })
      }
    },
    created() {
      let insurantListInfo = this.$route.query.insurantListInfo;
      let insurantList = JSON.parse(insurantListInfo);
      for(let key in insurantList){
        let insurant = insurantList[key];
        insurant['bankNo']=this.$myUtils.replaceStr(insurant.bankNo);
      }
      this.insurantList = insurantList;
    },
    components: {}
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less" rel="stylesheet/less">
  .offer {
    position: fixed;
    bottom: 0;
    width: 100%;
    background-image: linear-gradient(to left, #4c92ed, #61beec);
    height: 50px;
    line-height: 50px;
    color: #fff;
  }

  .tip {
    color: #e96775;
    font-size: 13px;
    text-align: left;
    padding: 10px;
  }

  .list {
    padding-bottom: 50px;
    .title {
      font-size: 20px;
      color: #2e94f0;
    }
    > li {
      margin: 10px;
      border-bottom: 1px solid #ddd;
      li {
        text-align: left;
        margin-bottom: 10px;
        div {
          position: relative;
          margin-bottom: 10px;
          span {
            position: absolute;
            background-color: rgba(46, 148, 240, 0.7);
            font-size: 15px;
            line-height: 40px;
            color: #fff;
            height: 40px;
            bottom: 0;
            width: calc(100% - 10px);
            padding-left: 10px;
          }
        }
        p:first-child {
          color: #2d93f0;
          font-size: 13px;
        }
        p:last-child {
          font-size: 15px;
          color: #111;
          span {
            margin-right: 10px;
          }
          :last-child {
            margin-right: 0;
          }
        }

      }
      :last-child {
        margin-bottom: 5px;
      }

    }
  }
</style>
